package com.ehotting.edsta.circuitDesign.config;

import ch.qos.logback.core.PropertyDefinerBase;
import java.net.InetAddress;
import java.net.UnknownHostException;

import com.alibaba.nacos.shaded.org.checkerframework.checker.units.qual.C;
import com.ehotting.mqbd.core.helper.IPHelper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

@Slf4j
public class LogIpConfig extends PropertyDefinerBase {
    @Autowired
    private IPHelper ipHelper;

    @Override
    public String getPropertyValue() {
        String ip = null;
//        ip = ipHelper.getIp();
        try {
            ip= InetAddress.getLocalHost().getHostAddress();
        } catch (UnknownHostException e) {
           log.error("获取IP失败", e);
        }
        return ip == null ? "failedToGet" : ip;
    }
}